define(function(require,exports,module){

	require.async("awardRotate");
	
	var rotateTimeOut = function (){
		$('#rotate').rotate({
			angle:0,
			animateTo:2160,
			duration:8000,
			callback:function (){
				tipsBox('网络超时，请检查您的网络设置！');
			}
		});
	};
	var bRotate = false;

	var rotateFn = function (angles, txt){
		bRotate = !bRotate;
		$('#rotate').stopRotate();
		$('#rotate').rotate({
			angle:0,
			animateTo:angles+1800,
			duration:8000,
			callback:function (){
				tipsBox(txt);
				bRotate = !bRotate;
			}
		})
	};
	
	$('.pointer').on("click",function(){
		$("#pointer").removeClass("pointer");
		$.ajax({
		      type:"get",
		      cache:false,
		      url:'/app/lottery/doSignLottery.html',
		      dataType:"json",
		      success:function(data){
		    	  if(data.resCode==1){
		    		  if(bRotate) return;
                      rotateFn(data.data.pos, data.data.message);
		    	  }else{
		    		  tipsBox(data.resMsg);
		    	  }
		      }
	    });
	});
	//定义积分抽奖公用弹出样式
	var tipsBox = function(txt){
		//构造确认框DOM
		layer.alert(txt,function(){
			window.location.href = "/mobile/usercenter/main.html";
		});
	};
});